import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class HLEmpty extends StatelessWidget {
  final String title;
  final String refreshTitle;
  final Function()? refreshAction;

  HLEmpty({
    super.key,
    this.title = "暂无数据",
    this.refreshTitle = "刷新",
    this.refreshAction,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
        child: Column(
      children: [
        Text(
          title,
          style: TextStyle(
            fontSize: 18,
            color: Colors.black87,
          ),
        ),
        SizedBox(height: 10),
        (refreshAction != null)
            ? CupertinoButton(
                child: Text(refreshTitle),
                onPressed: () {
                  refreshAction!();
                })
            : Container()
      ],
      mainAxisAlignment: MainAxisAlignment.center,
    ));
  }
}
